package com.sysmind.ravi.margin.service.impl;

import com.sysmind.ravi.margin.dao.UserDao;
import com.sysmind.ravi.margin.dao.impl.UserDaoImpl;
import com.sysmind.ravi.margin.model.User;
import com.sysmind.ravi.margin.service.UserService;

public class UserServiceImpl implements UserService
{	UserDao userDao;

	@Override
	public boolean addUser(User user) 
	{	userDao = new UserDaoImpl();
		boolean result =  userDao.addUser(user);
		userDao = null;
		return result;
		// TODO Auto-generated method stub
		
	}

	@Override
	public User authenticateUser(String email, String password) 
	{	userDao = new UserDaoImpl();
		User user = userDao.authenticateUser(email, password);
		userDao = null;
		// TODO Auto-generated method stub
		return user;
	}

	@Override
	public boolean userExists(String emailId)
	{	userDao = new UserDaoImpl();
		boolean result =  userDao.userExists(emailId);
		userDao = null;
		return result;
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean updateUser(User user)
	{	userDao = new UserDaoImpl();
		boolean result = userDao.updateUser(user);
		userDao = null;
		// TODO Auto-generated method stub
		return result;
	}

}
